package com.jiang5sx.commom.core;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

public class TimeUtils {

    // 获取当前月的统计周期字符串
    public static String getCurrentMonthPeriod() {
        LocalDate currentDate = LocalDate.now();
        LocalDate firstDayOfMonth = currentDate.withDayOfMonth(1);
        LocalDate lastDayOfMonth = currentDate.withDayOfMonth(currentDate.lengthOfMonth());
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy年M月d日");
        return firstDayOfMonth.format(formatter) + "-" + lastDayOfMonth.format(formatter);
    }

}
